<?php include TMPL_PATH.'public/header.phtml';?>
<style type="text/css">
<!--
.table-list th {
    background: none repeat scroll 0 0 #EEF3F7;
    border-bottom: 1px solid #D5DFE8;
    font-weight: normal;
    height: 30px;
}
-->
</style>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
    	<div style="float:left;margin-right:50px;">
        <a href='javascript:;' class="on"><em>订单列表</em></a>
      </div>
       <?php 
       	 $order_status = isset($search['order_status']) ? $search['order_status'] : null;
       	 $payment_status = isset($search)&& $search['payment_status'] ? $search['payment_status'] : null;
       	 $shipping_status = isset($search)&& $search['shipping_status'] ? $search['shipping_status'] : null;
				 $designer_id = isset($search)&& $search['designer_id'] ? $search['designer_id'] : -1;
				 ?>
    	<div style="color:#000;">
    		<form name="searchform" action="<?php echo U('order/order_designer_list');?>"  method="post">
    		<input type="hidden" value="1" name="search">
    		订单状态：<select name="order_status">
    		<option value='9999' <?php if(9999==$order_status)echo 'selected';?>>≡ 全部  ≡</option>
				<?php foreach (OrderModel::$orderStatusCn as $status_key => $status_name):?>
				<option value='<?php echo $status_key?>' <?php if(!is_null($order_status) && $status_key==$order_status)echo 'selected';?>><?php echo $status_name;?></option>
				<?php endforeach;?>
				</select>&nbsp;&nbsp;&nbsp;付款状态：<select name="payment_status">
				 	<option value='9999' <?php if(9999==$payment_status)echo 'selected';?>>≡ 全部  ≡</option>
				 	<?php foreach (OrderModel::$paymentStatus as $status_key => $status_name):?>
				<option value='<?php echo $status_key?>' <?php if(!is_null($payment_status) && $status_key==$payment_status)echo 'selected';?>><?php echo $status_name;?></option>
				<?php endforeach;?>
				 </select>&nbsp;&nbsp;&nbsp;配送状态：<select name="shipping_status">
				 	<option value='9999' <?php if(9999==$shipping_status)echo 'selected';?>>≡ 全部  ≡</option>
				 	<?php foreach (OrderModel::$shippingStatus as $status_key => $status_name):?>
				<option value='<?php echo $status_key?>' <?php if(!is_null($shipping_status) && $status_key==$shipping_status)echo 'selected';?>><?php echo $status_name;?></option>
				<?php endforeach;?>
				 </select>&nbsp;&nbsp;&nbsp;
				 设计师：<select name="designer_id">
				 <option value="-1">≡ 全部  ≡</option>
				 <option value="0" <?php if($designer_id == 0)echo 'selected';?>>自己团队</option>
				 <?php 
					 if($designerList):
					 	foreach ($designerList as $designer):
				 ?>
					<option <?php if($designer['id'] && $designer_id==$designer['id'])echo 'selected';?> value="<?php echo $designer['id'];?>"><?php echo $designer['username'];?></option>
				<?php 
						endforeach;
					endif;
				?>
				</select>
				<input type="submit" value="搜索" class="button" name="search">
    		</form>
    	</div>
    </div>
</div>
<div class="bk"></div>
<div class="pad_10">
<div class="table-list">
    <table width="100%" cellspacing="0" >
    <?php
   	if(isset($orderList) && $orderList):
   		foreach ($orderList as $order):
   			if(empty($order['productList'])) continue;
   ?>
   				<tr>
            <th width="250">订单号：<?php echo $order['order_sn']?></th>
            <th align='center' width="300">订单状态：<?php echo OrderModel::$orderStatusCn[$order['order_status']];?>,
					<?php echo OrderModel::$paymentStatus[$order['payment_status']];?>,
					<?php echo OrderModel::$shippingStatus[$order['shipping_status']];?></th>
            <th align='center' width="200">下单时间：<?php echo date('Y-m-d H:i:s', $order['start_time']);?></th>
						<th><a href="<?php echo U('order/order_edit', 'oid='.$order['id']);?>">查看订单</a></th>
          </tr>
     <?php if($order['productList']):?>
     <tr><td colspan="4">
     		<table width="100%">
     			<tr>
     				<td align='center' width="100">图片</td>
     				<td align='left' width="300">产品名称</td>
     				<td align='left' width="*">属性</td>
     				<td align='center' width="100">设计师</td>
     				<td align='center' width="80">单价</td>
     				<td align='center' width="80">数量</td>
     				<td align='center' width="80">总价</td>
     				<td align='center' width="80">定制类型</td>
     			</tr>
      <?php	foreach ($order['productList'] as $product):?> 
			<tr>
				<td align='center'><?php echo $product['small_img'] ? '<img src="'.$product['small_img'].'"/>' : null;?></td>
					<td align='left'><?php echo $product['product_name']?><br/><?php echo $product['product_sn']?></td>
					<td align='left'><?php echo $product['attr'];?></td>
					<td align='center'><?php echo $product['username'];?></td>
					<td align='center'><?php echo $product['sell_price'];?></td>
					<td align='center'><?php echo $product['qty'];?></td>
					<td align='center'><?php echo $product['total_amount'];?></td>
					<td align='center'><?php echo OrderModel::$customType[$product['custom_type']];?></td>
				</tr>
				<?php endforeach;?>
				</table></td></tr>
	<?php 
				endif;
		endforeach;
		else:
	?>
		<tr><td>暂无结果</td></tr>
		<?php endif;?>
    </table>
<div id="pages"><?php echo $pageShow;?></div>
</div>
</div>
</body>
</html>